//
//  BindingActivityIndicatorView.swift
//  DaFit
//
//  Created by 尹琼 on 2023/7/25.
//  Copyright © 2023 sylar. All rights reserved.
//

import UIKit
import SnapKit

open class IndicatorView: UIImageView {
    
    open func animating(duration: TimeInterval = 0.25) {
        
         UIView.animate(withDuration: duration, delay: 0, options: .layoutSubviews) {[weak self] in
            
             self?.transform = CGAffineTransform(rotationAngle: CGFloat.pi)

         } completion: {[weak self] _ in
             
             self?.removeAnimating()
            
         }

    }
    
    
     open func removeAnimating(duration: TimeInterval = 0.25) {
         
         UIView.animate(withDuration: duration) {[weak self] in
             
             self?.transform = CGAffineTransform.identity
             
         } completion: {[weak self] _ in
             
             self?.animating()
         }
         
         
    }
    
}
